<div class = "ui large modal delSource">

    <i class = "close icon" ng-click="closeDelSource()"></i>
    <div class = "header">
        数据源管理
    </div>
    <div class="content" ng-show="!delSour && !delSourTable">
        <table class="ui celled table">
            <thead>
            <tr align="center">
                <th>序号</th>
                <th>数据源</th>
                <th>类型</th>
                <th>数据服务IP</th>
                <th>端口号</th>
                <th>字符编码</th>
                <th>用户名</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr dir-paginate ="item in sourceData | itemsPerPage: 4 track by $index" current-page="pagination.current" pagination-id="delSource">
                <td>
                    <!--<div class="ui ribbon label" ng-show="$first">First</div>-->
                    <div>{{(pagination.current-1)*4+$index}}</div>

                </td>
                <td title="{{item.sourceDesc}}">{{item.sourceDesc}}</td>
                <td title="{{item.type}}">{{item.type}}</td>
                <td title="{{item.sourceServerIp}}">{{item.sourceServerIp}}</td>
                <td title="{{item.portnumber}}">{{item.portnumber}}</td>
                <td title="{{item.characterEncoding}}">{{item.characterEncoding}}</td>
                <td title="{{item.sourceUserName}}">{{item.sourceUserName}}</td>
                <td>
                    <button class="ui red basic button" ng-click="showDelSource((pagination.current-1)*4+$index)">删除</button>
                    <button class="ui red basic button" ng-click="showDelSourceTable((pagination.current-1)*4+$index)">清空表</button>
                </td>
            </tr>
            <tfoot ng-show="sourceData.length>4">
            <tr><th colspan="8">
                <dir-pagination-controls pagination-id="delSource"
                                         max-size="4"
                                         direction-links="true"
                                         boundary-links="true"></dir-pagination-controls>
            </th>
            </tr></tfoot>
            </tbody>
        </table>
    </div>
    <div class="content tc" ng-show="delSour">
        <div class="tc">
            <h3 class="ui red header pt100"><i class="warning sign icon"></i>是否删除该数据源</h3>


            <div class="actions pd10">
                <button class="ui button" ng-click="confimDelSource()">确认删除</button>
                <button class="ui button green" ng-click="delSour=false;">返回</button>
            </div>

        </div>
    </div>
    <div class="content tc delSourTable" ng-show="delSourTable">
        <button class="ui button green fl" ng-click="delSourTable=false;"><i class="arrow circle left icon"></i>返回</button>
        <div style="clear: both"></div>
        <div class="tc">
            <h3 class="ui header red"><i class="warning sign icon"></i>删除该数据源下的所有表,所有基于该表的报表将全部清除</h3>
            <table class="ui celled table">
                <thead>
                <tr align="center">
                    <th>数据源</th>
                    <th>数据类型</th>
                    <th>数据表数</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td rowspan="4">{{sourceData[sourceIndex].sourceDesc}}</td>
                    <td>数据库源数据</td>
                    <td>{{dbTables.base.length}}</td>
                    <td>
                        <button ng-show="dbTables.base.length>0" class="ui red basic button" ng-click="confimDelSourceTable('base')">清空表</button>
                        <div ng-show="dbTables.base.length==0" class="ui basic button">已清空</div>
                    </td>
                </tr>
                <tr>
                    <td style="border-left: 1px solid rgba(34,36,38,.1);">多表关联数据</td>
                    <td>{{dbTables.mulRelation.length}}</td>
                    <td>
                        <button ng-show="dbTables.mulRelation.length>0" class="ui red basic button" ng-click="confimDelSourceTable('mulRel')">清空表</button>
                        <div ng-show="dbTables.mulRelation.length==0" class="ui basic button">已清空</div>
                    </td>
                </tr>
                <tr>

                    <td style="border-left: 1px solid rgba(34,36,38,.1);">分类汇总数据</td>
                    <td>{{dbTables.aggregation.length}}</td>
                    <td>
                        <button ng-show="dbTables.aggregation.length>0" class="ui red basic button" ng-click="confimDelSourceTable('agg')">清空表</button>
                        <div ng-show="dbTables.aggregation.length==0" class="ui basic button">已清空</div>
                    </td>
                </tr>
                <tr>

                    <td style="border-left: 1px solid rgba(34,36,38,.1);">上传文件数据</td>
                    <td>{{dbTables.filetable.length}}</td>
                    <td>
                        <button ng-show="dbTables.filetable.length>0" class="ui red basic button" ng-click="confimDelSourceTable('file')">清空表</button>
                        <div ng-show="dbTables.filetable.length==0" class="ui basic button">已清空</div>
                    </td>
                </tr>
                </tbody>
            </table>
            <p class="ui red mt10" ng-show="delmsg">{{delmsg}}</p>

            <!--<div class="actions">
                <button class="ui button delSourTableBtn" ng-click="confimDelSourceTable()">确认清空</button>
                <button class="ui button green" ng-click="delSourTable=false;">返回</button>
            </div>-->

        </div>
    </div>
    <div class = "actions" ng-show="!hasDone">
        <div class="fl ml10 mt10" style="color:red;max-width: 380px;text-align: left" ng-show="msg">{{msg}}</div>

        <button class = "ui green right labeled icon button" ng-click="closeDelSource()">
            <span>关闭</span>
            <i class = "checkmark icon"></i>
        </button>
    </div>
</div>